<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('代理商推送配置列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px;">推送的类型：</label>
                                <select name="asyType">
                                    <option value="">所有</option>
                                    <option value="0">商户</option>
                                    <option value="1">交易</option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 100px;">推送状态：</label>
                                <select name="status">
                                    <option value="">所有</option>
                                    <option value="0">推送</option>
                                    <option value="1">关闭</option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 100px;">代理编号：</label>
                                <input type="text" name="agentNum"/>
                            </li>
                            <li>
                                <label style="width: 10px;"></label>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="agentAysinfo:agentAysinfo:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:aysinfo:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="agentAysinfo:agentAysinfo:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="agentAysinfo:agentAysinfo:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('agentAysinfo:agentAysinfo:edit')}]];
        var removeFlag = [[${@permission.hasPermi('agentAysinfo:agentAysinfo:remove')}]];
        var prefix = ctx + "agentAysinfo/agentAysinfo";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "代理商推送配置",
                clickToSelect:true,
                columns: [
                    {
                        checkbox: true
                    },

                    {
                    field: 'id',
                    title: '序号',
                },
                {
                    field: 'agentUrl',
                    title: '代理推送地址'
                },
                {
                    field: 'asyType',
                    title: '推送的类型',
                    formatter:function(value,row,index){
                        if (value == '0'){
                            return "商户";
                        } else if (value == '1'){
                            return "交易";
                        }
                    }
                },
                {
                    field: 'status',
                    title: '推送状态',
                    formatter:function(value,row,index){
                    return statusTools(row);
                }
                },
                {
                    field: 'agentNum',
                    title: '代理编号'
                },
                {
                    field: 'agentPub',
                    title: '代理公钥'
                },
                {
                    field: 'sysPri',
                    title: '系统私钥'
                },
                {
                    field: 'sysPub',
                    title: '系统公钥'
                },
                {
                    field: 'addName',
                    title: '添加人'
                },
                {
                    field: 'localdate',
                    title: '添加日期'
                },
                {
                    field: 'localtime',
                    title: '添加时间'
                }]
            };
            $.table.init(options);
        });

        /* 业务员状态 */
        function statusTools(row) {
            if (row.status == 0) {
                return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.id + '\')"></i> ';
            } else {
                return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.id + '\')"></i> ';
            }
        }
        /* 业务员-停用 */
        function disable(id) {
            $.modal.confirm("确认要禁用当前推送吗？", function() {
                $.operate.post(prefix + "/edit", {"id": id,"status": '1'});
            })
        }

        /* 业务员-启用 */
        function enable(id) {
            $.modal.confirm("确认要启用当前推送吗？", function() {
                $.operate.post(prefix + "/edit", {"id": id,"status": '0'});
            })
        }
    </script>
</body>
</html>